### Packages
import sys
import os
import numpy as np
import cv2
### change the current working directory
os.chdir(r'D:\image')
### 입력 영상 이름
img_names = ['hnu_20220530_01.jpg', 'hnu_20220530_02.jpg']
### 영상 저장
imgs = []
for name in img_names:
img = cv2.imread(name)
if img is None:
print('Image load failed!')
sys.exit()
imgs.append(img)
### 이미지 스티칭
stitcher = cv2.Stitcher_create()
status,dst = stitcher.stitch(imgs)
if status != cv2.Stitcher_OK:
print('Stitch failed!')
sys.exit()
### 파노라마 영상 저장
cv2.imwrite('output.jpg',dst)
### 파노라마 영상 출력
cv2.namedWindow('dst',cv2.WINDOW_NORMAL)
cv2.imshow('dst',dst)
cv2.waitKey()
cv2.destroyAllWindows()